﻿var trunPageObj;//翻页组件对像
$(initPage);
function initPage() {
    trunPageObj =  $(".pageNext").turnPage(12, exportList);
    
	$("#queryLog").click(function() {
		$("#log_list").empty();
		trunPageObj.gotoPage(1);//搜索第一页
	});
	trunPageObj.gotoPage(1);//搜索第一页
}

function queryList(){
	var pageno=trunPageObj.getCurrentPageNo();//当前第几页
	var pagecount=trunPageObj.getPageCount();//一页多少条
	$.post("m/data_adjust/querylog", {
		pageNo: pageno,
		pageSize : pagecount,
		busiDate : $.trim($("#busiDate").val()),
		opType : $.trim($("#opType").val())
	}, function(data) {
		if ($.checkErrorMsg(data) ) {
			var fileList = [];
			if(data.rptA13BakPage && data.rptA13BakPage.dataList){
				var dataList = data.rptA13BakPage.dataList;
				$(dataList).each(function(i) {
					fileList.push("<tr class='table_td_font' bgColor='#ffffff'>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" +dataList[i].oprDateTime + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" +dataList[i].opTypeText + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" +dataList[i].arapTypeText + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].arapReasonText + "</td>");
					fileList.push("<td align='center'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].formatTradeDate + "</td>");
					fileList.push("<td align='center'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].curTypeSipfText + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].oppParText + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].mktCodeSipfText + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].arapBusiTypeText + "</td>");
					fileList.push("<td align='right'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].arapAmtText + "</td>");
					fileList.push("<td align='center'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].formatHarapDate + "</td>");
					fileList.push("<td align='center'  height='25px' class='queryList_linebg' nowrap>" + dataList[i].formatArapDate + "</td>");
					fileList.push("<td align='left'  height='25px' class='queryList_linebg' nowrap>" + (dataList[i].summary ? dataList[i].summary : "")  + "</td>");
					fileList.push("<td align='left'  height='25px' style='display:none;' class='queryList_linebg' nowrap value='" + dataList[i].id.companyCode + "'></td>");
					fileList.push("</tr>");
				});
			}
			$("#data_list").html(fileList.join(""));
			trunPageObj.setPageData(data.rptA13BakPage);
		} 
	}, "json");
}

function exportList() {
	var obj = window.showModalDialog(BASE_PATH + "page/export_select.jsp","","dialogWidth:200px;dialogHeight:80px;help:no;center:yes;status:no");
	if (obj) {
		window.open("m/data_adjust/exporta13log?busiDate=" + $.trim($("#busiDate").val()) + "&opType=" + $.trim($("#opType").val()) + "&expType=" + obj);
	}
}